import Vue from 'vue'
import Router from 'vue-router'
import Login from '../views/XiaoLogin'
import Register from '../views/XiaoRegister'
import perMain from '../views/userinformationmodified/XiaoperMain'
import NotFound from '../views/XiaoNotFound'
import changepassowrd from '../views/userinformationmodified/permainpagerouter/Xiaochangepassowrd'
import personaldata from '../views/userinformationmodified/permainpagerouter/Xiaopersonaldata'
import uploadavatar from '../views/userinformationmodified/permainpagerouter/Xiaouploadavatar'
import receivemanagement from '../views/userinformationmodified/permainpagerouter/Xiaoreceivemanagement'
import edreceivemanagement from '../views/userinformationmodified/permainpagerouter/Xiaoedreceivemanagement'
import refreshpage from '../views/userinformationmodified/permainpagerouter/Xiaorefreshpage'
import refreshpageNothing from '../views/userinformationmodified/permainpagerouter/XiaorefreshpageNothing'
import HomePage from '../views/homepage/XiaoHomePage'
import ProductDetails from '../views/productdetails/XiaoProductDetails'
import Cart from '../views/shoppingcart/XiaoCart'
import CreateOrder from '../views/createorder/XiaoCreateOrder'
import xCOrefreshpage from '../views/createorder/XiaoCOrefreshpage'
import Pay from '../views/pay/XiaoPay'
import OrderList from '../views/orderlist/XiaoOrderList'
import OrderDetail from '../views/orderdetail/XiaoOrderDetail'

import PxReg from '../views/PhoneView/PxReg'
import PxLogin from '../views/PhoneView/PxLogin'
import PxPersionMain from '../views/PhoneView/PxPersionMain/PxPersionMain'
import PxOrderList from '../views/PhoneView/PxOrderList/PxOrderList'
import PxCart from '../views/PhoneView/PxCart/PxCart'
import PxMain from '../views/PhoneView/PxMain/PxMain'
import PxChangePsw from '../views/PhoneView/PxPersionMain/router/PxChangePsw'
import PxChangeInfo from '../views/PhoneView/PxPersionMain/router/PxChangeInfo'
import PxChangeAdd from '../views/PhoneView/PxPersionMain/router/PxChangeAdd'
import PxChangeAddRefresh from '../views/PhoneView/PxPersionMain/router/PxChangeAddRefresh'
import PxOLProgress from '../views/PhoneView/PxOrderList/PxOLProgress'
import PxOrderDetails from '../views/PhoneView/PxOrderDetails/PxOrderDetails'
import PxProductDetails from '../views/PhoneView/PxProductDetails/PxProductDetails'
import PxCreateOrder from '../views/PhoneView/PxCreateOrder/PxCreateOrder'
import PxPay from '../views/PhoneView/PxPay/PxPay'
import PxTake_outTest from '../views/PhoneView/PxTake-outTest/PxTake_outTest'
import PxJudgeIFPay from '../views/PhoneView/PxPay/PxJudgeIFPay'

import XiaoBindPhone from '../views/XiaoBindPhone'


// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = Router.prototype.push
    Router.prototype.push = function push(location) {
        return originalPush.call(this, location).catch(err => err)
}
Vue.use(Router)

export default new Router({
    mode:'history',
    routes:[
        {   //如果notfound就前往notfound页面
            path:'*',
            component:NotFound,
        },
        {
            //注册页
            path:'/xregister',
            name:'xRegister',
            component:Register
        },
        {
            //绑定手机号码页面
            path:'/xBindPhone',
            name:'XiaoBindPhone',
            component:XiaoBindPhone
        },
        {
            //登陆页
            path:'/xlogin',
            name:'xLogin',
            component:Login
        },
        {
            //个人主页
            path:'/xpermain',
            name:'xperMain',
            component:perMain,
            children:[
                {
                    path:'/xchangepsw',
                    name:'xchangepsw',
                    component:changepassowrd,
                    props:true,
                },
                {
                    path:'/xperdata',
                    name:'xperdata',
                    component:personaldata,
                    props:true,
                },
                {
                    path:'/xuploadavatar',
                    name:'xuploadavatar',
                    component:uploadavatar,
                    props:true,
                },
                {
                    path:'/xrecmanage',
                    name:'xrecmanage',
                    component:receivemanagement,
                    props:true,
                    children:[{
                        path:'/xedrecmanage',
                        name:'xedrecmanage',
                        component:edreceivemanagement,
                        props:true,
                    }]
                },
                {
                    path:'/xrefreshpage',
                    name:'xrefreshpage',
                    component:refreshpage,
                },
                {
                    path:'/xrefreshpagenothing',
                    name:'xrefreshpageNothing',
                    component:refreshpageNothing,
                },
            ]
        },
        {   //前往个人主页
            path:'/gopermain',
            redirect:'/xpermain'
        },
        {   //首页
            path:'/xhomepage',
            name:'xHomepage',
            component:HomePage
        },
        {   //商品详情页
            path:'/productdetails',
            name:'xProductDetails',
            component:ProductDetails
        },
        {   //购物车页面
            path:'/cart',
            name:'xCart',
            component:Cart
        },
        {   //创建订单页面
            path:'/createorder',
            name:'xCreateOrder',
            component:CreateOrder
        },
        {   //为创建订单刷新的页面
            path:'/corefreshpage',
            name:'xCOrefreshpage',
            component:xCOrefreshpage
        },
        {   //支付页面
            path:'/pay',
            name:'xPay',
            component:Pay
        },
        {   //订单列表页面
            path:'/orderlist',
            name:'xOrderList',
            component:OrderList
        },
        {   //订单详情页面
            path:'/orderdetail',
            name:'xOrderDetail',
            component:OrderDetail
        },
        {   //手机注册页
            path:'/PxReg',
            name:'PxReg',
            component:PxReg
        },
        {   //手机登陆页
            path:'/PxLogin',
            name:'PxLogin',
            component:PxLogin
        },
        {   //个人信息主页
            path:'/PxPersionMain',
            name:'PxPersionMain',
            component:PxPersionMain
        },
        {   //个人信息主页-----修改密码
            path:'/PxChangePsw',
            name:'PxChangePsw',
            component:PxChangePsw
        },
        {   //个人信息主页-----修改个人信息
            path:'/PxChangeInfo',
            name:'PxChangeInfo',
            component:PxChangeInfo
        },
        {   //个人信息主页-----修改收货地址
            path:'/PxChangeAdd',
            name:'PxChangeAdd',
            component:PxChangeAdd
        },
        {   //个人信息主页-----修改收货地址-----刷新页面
            path:'/PxChangeAddRefresh',
            name:'PxChangeAddRefresh',
            component:PxChangeAddRefresh
        },
        {   //订单列表
            path:'/PxOrderList',
            name:'PxOrderList',
            component:PxOrderList
        },
        {   //订单列表-----刷新页面
            path:'/PxOLProgress',
            name:'PxOLProgress',
            component:PxOLProgress
        },
        {   //订单详情页面
            path:'/PxOrderDetails',
            name:'PxOrderDetails',
            component:PxOrderDetails
        },
        {   //购物车
            path:'/PxCart',
            name:'PxCart',
            component:PxCart
        },
        {   //创建订单页面
            path:'/PxCreateOrder',
            name:'PxCreateOrder',
            component:PxCreateOrder
        },
        {   //创建订单------之后的支付页面
            path:'/PxPay',
            name:'PxPay',
            component:PxPay
        },
        {   //商品详情页面
            path:'/PxProductDetails',
            name:'PxProductDetails',
            component:PxProductDetails
        },
        {   //主页
            path:'/PxMain',
            name:'PxMain',
            component:PxMain
        },
        {   //外卖测试页面
            path:'/PxTake_outTest',
            name:'PxTake_outTest',
            component:PxTake_outTest
        },
        {
            //判断是否支付
            path:'/PxJudgeIFPay',
            name:'PxJudgeIFPay',
            component:PxJudgeIFPay
        }
    ]
})